package com.spring.sunflower.anchor;

import com.spring.sunflower.base.BaseObserver;
import com.spring.sunflower.base.BasePresenter;
import com.spring.sunflower.bean.PhotoListBean;
import com.spring.sunflower.common.CommonContract;

import java.util.Map;

import io.reactivex.rxjava3.core.Observable;

/**
 * Created by Kevin on 2021/9/13<br/>
 * <p>
 * Describe:<br/>
 */
public class PhotoListPresenter extends BasePresenter<CommonContract.PhotoListView> {
    public PhotoListPresenter(CommonContract.PhotoListView baseView) {
        super(baseView);
    }
    public void queryPhoto(Map<String, String> map) {
        Observable<PhotoListBean> observable = requestDataSource.queryPhoto(map);
        addDisposable(observable, new BaseObserver<PhotoListBean>(baseView) {

            @Override
            public void onSuccess(PhotoListBean bean) {
                baseView.querySuccess(bean.getDatas());
            }

            @Override
            public void onError(int status, String msg) {
                baseView.queryFailed();
            }
        });
    }
}
